package edu.gatech.oad.antlab.person;

import java.awt.EventQueue;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import java.awt.GridBagLayout;
import javax.swing.JTextPane;
import java.awt.GridBagConstraints;
import javax.swing.JTextField;
import java.awt.Insets;
import javax.swing.JRadioButton;
import javax.swing.ButtonGroup;


import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;


/**
 * Create a frame that holds the panels for our GUI. The panels hold the text boxes, radio buttons, and text fields. This will allow the player to configure their 
 * loading screen. 
 * @author Browntourage 
 *
 */
public class StoreScreen extends JFrame
{
	//Declare all the text fields, radiobuttons, textpanes, player control and profession class.
	
	private JPanel contentPane;
	
	private JRadioButton rdbtnBuy;
	private JRadioButton rdbtnSell;
	private final ButtonGroup buySell = new ButtonGroup();
	
	private int bulletPrice = 5;
	private int bottlePrice = 5;
	private int mealPrice = 5;
	private int animalPrice = 5;
	private int wheelPrice = 5;
	private int axlePrice = 5;
	private int tonguePrice = 5;
	
	private int bulletWeight = 5;
	private int bottleWeight = 5;
	private int mealWeight = 5;
	private int animalWeight = 5;
	private int wheelWeight = 5;
	private int axleWeight = 5;
	private int tongueWeight = 5;
	
	
	private JTextPane txtpnStore;
	private JTextPane txtpnBrowntourage;
	private boolean isBuy = true;
	
	private JTextPane txtpnAmmunition;
	private JTextPane txtpnbullet;
	private JTextField textFieldAmmunition;
	private JTextPane txtpnAmmunitionCost;
	
	private JTextPane txtpnMedicine;
	private JTextPane txtpnbottle;
	private JTextField textFieldMedicine;
	private JTextPane txtpnMedicineCost;
	
	private JTextPane txtpnFood;
	private JTextPane txtpnmeal;
	private JTextField textFieldFood;
	private JTextPane txtpnFoodCost;
	
	private JTextPane txtpnOxen;
	private JTextPane txtpnanimal;
	private JTextField textFieldOxen;
	private JTextPane txtpnOxenCost;
	
	
	private JTextPane txtpnWagonParts;
	
	private JTextPane txtpnWheel;
	private JTextPane txtpnwheel;
	private JTextField textFieldWheel;
	private JTextPane txtpnWheelCost;

	private JTextPane txtpnAxle;
	private JTextPane txtpnaxle;
	private JTextField textFieldAxle;
	private JTextPane txtpnAxleCost;
	
	private JTextPane txtpnTongue;
	private JTextPane txtpntongue;
	private JTextField textFieldTongue;
	private JTextPane txtpnTongueCost;
	private JTextPane txtpnCash;
	private JTextPane txtpnWeight;
	
	private JTextPane txtpnCostLabel;
	private JTextPane txtpnTotalCost;
	private JTextPane txtpnTotalWeight;
	private JTextPane txtpnWeightLabel;
	
	
	private JButton btnCalculate;
	private JButton btnSealTheDeal;
	
	
	/**
	 * Launch the application.
	 * Create a main so that the panel can be launched on the frame. 
	 */
	public static void main(String[] args)
	{
		EventQueue.invokeLater(new Runnable()
		{
			public void run()
			{
				try
				{
					StoreScreen frame = new StoreScreen();
					frame.setVisible(true);
				} catch (Exception e)
				{
					e.printStackTrace();
				}
			}
		});
	}


	/**
	 * Create the frame.
	 */
	public StoreScreen()
	{
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 661, 592);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		contentPane.setBackground(Color.orange);
		setContentPane(contentPane);
		GridBagLayout gbl_contentPane = new GridBagLayout();
		gbl_contentPane.columnWidths = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
		gbl_contentPane.rowHeights = new int[]{25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 22, 25, 22, 26, 25, 0, 0, 0, 0};
		gbl_contentPane.columnWeights = new double[]{0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, Double.MIN_VALUE};
		gbl_contentPane.rowWeights = new double[]{1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
		contentPane.setLayout(gbl_contentPane);
		ButtonListener listener = new ButtonListener();
		CalculateListener calculateListener = new CalculateListener();
		
		txtpnStore = new JTextPane();
		txtpnStore.setEditable(false);
		txtpnStore.setText("Hello! How may we help you?");
		GridBagConstraints gbc_txtpnStore = new GridBagConstraints();
		gbc_txtpnStore.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnStore.fill = GridBagConstraints.BOTH;
		gbc_txtpnStore.gridx = 9;
		gbc_txtpnStore.gridy = 0;
		contentPane.add(txtpnStore, gbc_txtpnStore);
		
		
		rdbtnBuy = new JRadioButton("Buy");
		rdbtnBuy.setBackground(Color.orange);
		rdbtnBuy.addActionListener(listener); 
		buySell.add(rdbtnBuy);
		GridBagConstraints gbc_rdbtnBuy = new GridBagConstraints();
		gbc_rdbtnBuy.insets = new Insets(0, 0, 5, 5);
		gbc_rdbtnBuy.anchor = GridBagConstraints.WEST;
		gbc_rdbtnBuy.gridx = 5;
		gbc_rdbtnBuy.gridy = 1;
		contentPane.add(rdbtnBuy, gbc_rdbtnBuy);
		
		rdbtnSell = new JRadioButton("Sell");
		rdbtnSell.setBackground(Color.orange);
		rdbtnSell.addActionListener(listener); 
		buySell.add(rdbtnSell);
		GridBagConstraints gbc_rdbtnSell = new GridBagConstraints();
		gbc_rdbtnSell.insets = new Insets(0, 0, 5, 5);
		gbc_rdbtnSell.anchor = GridBagConstraints.WEST;
		gbc_rdbtnSell.gridx = 12;
		gbc_rdbtnSell.gridy = 1;
		contentPane.add(rdbtnSell, gbc_rdbtnSell);
		
/**
 * Ammunition
 */
		
		txtpnAmmunition = new JTextPane();
		txtpnAmmunition.setText("Ammunition");
		GridBagConstraints gbc_txtpnAmmunition = new GridBagConstraints();
		gbc_txtpnAmmunition.gridwidth = 4;
		gbc_txtpnAmmunition.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnAmmunition.fill = GridBagConstraints.BOTH;
		gbc_txtpnAmmunition.gridx = 5;
		gbc_txtpnAmmunition.gridy = 2;
		contentPane.add(txtpnAmmunition, gbc_txtpnAmmunition);
		
		txtpnbullet = new JTextPane();
		txtpnbullet.setText("Price: $" + bulletPrice + "/bullet, Weight: "+ bulletWeight + "pounds/bullet");
		GridBagConstraints gbc_txtpnbullet = new GridBagConstraints();
		gbc_txtpnbullet.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnbullet.fill = GridBagConstraints.BOTH;
		gbc_txtpnbullet.gridx = 9;
		gbc_txtpnbullet.gridy = 2;
		contentPane.add(txtpnbullet, gbc_txtpnbullet);
		
		textFieldAmmunition = new JTextField();
		textFieldAmmunition.setText("0");
		GridBagConstraints gbc_textFieldAmmuntion = new GridBagConstraints();
		gbc_textFieldAmmuntion.anchor = GridBagConstraints.ABOVE_BASELINE;
		gbc_textFieldAmmuntion.gridwidth = 4;
		gbc_textFieldAmmuntion.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldAmmuntion.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldAmmuntion.gridx = 12;
		gbc_textFieldAmmuntion.gridy = 2;
		contentPane.add(textFieldAmmunition, gbc_textFieldAmmuntion);
		textFieldAmmunition.setColumns(10);
		
		txtpnAmmunitionCost = new JTextPane();
		txtpnAmmunitionCost.setEditable(false);
		GridBagConstraints gbc_txtpnAmmunitionCost = new GridBagConstraints();
		gbc_txtpnAmmunitionCost.gridwidth = 4;
		gbc_txtpnAmmunitionCost.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnAmmunitionCost.fill = GridBagConstraints.BOTH;
		gbc_txtpnAmmunitionCost.gridx = 16;
		gbc_txtpnAmmunitionCost.gridy = 2;
		contentPane.add(txtpnAmmunitionCost, gbc_txtpnAmmunitionCost);
		
/**
 * Medicine		
 */
		
		txtpnMedicine = new JTextPane();
		txtpnMedicine.setText("Medicine");
		GridBagConstraints gbc_txtpnMedicine = new GridBagConstraints();
		gbc_txtpnMedicine.gridwidth = 4;
		gbc_txtpnMedicine.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnMedicine.fill = GridBagConstraints.BOTH;
		gbc_txtpnMedicine.gridx = 5;
		gbc_txtpnMedicine.gridy = 3;
		contentPane.add(txtpnMedicine, gbc_txtpnMedicine);
		
		txtpnbottle = new JTextPane();
		txtpnbottle.setText("Price: $" + bottlePrice + "/bottle, Weight: "+ bottleWeight + "pounds/bottle");
		GridBagConstraints gbc_txtpnbottle = new GridBagConstraints();
		gbc_txtpnbottle.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnbottle.fill = GridBagConstraints.BOTH;
		gbc_txtpnbottle.gridx = 9;
		gbc_txtpnbottle.gridy = 3;
		contentPane.add(txtpnbottle, gbc_txtpnbottle);
		
		textFieldMedicine = new JTextField();
		textFieldMedicine.setText("0");
		GridBagConstraints gbc_textFieldMedicine = new GridBagConstraints();
		gbc_textFieldMedicine.anchor = GridBagConstraints.ABOVE_BASELINE;
		gbc_textFieldMedicine.gridwidth = 4;
		gbc_textFieldMedicine.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldMedicine.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldMedicine.gridx = 12;
		gbc_textFieldMedicine.gridy = 3;
		contentPane.add(textFieldMedicine, gbc_textFieldMedicine);
		textFieldMedicine.setColumns(10);
		
		txtpnMedicineCost = new JTextPane();
		txtpnMedicineCost.setEditable(false);
		GridBagConstraints gbc_txtpnMedicineCost = new GridBagConstraints();
		gbc_txtpnMedicineCost.gridwidth = 4;
		gbc_txtpnMedicineCost.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnMedicineCost.fill = GridBagConstraints.BOTH;
		gbc_txtpnMedicineCost.gridx = 16;
		gbc_txtpnMedicineCost.gridy = 3;
		contentPane.add(txtpnMedicineCost, gbc_txtpnMedicineCost);
		
/**
 * Food		
 */
		
		txtpnFood = new JTextPane();
		txtpnFood.setText("Food");
		GridBagConstraints gbc_txtpnFood = new GridBagConstraints();
		gbc_txtpnFood.gridwidth = 4;
		gbc_txtpnFood.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnFood.fill = GridBagConstraints.BOTH;
		gbc_txtpnFood.gridx = 5;
		gbc_txtpnFood.gridy = 4;
		contentPane.add(txtpnFood, gbc_txtpnFood);
		
		txtpnmeal = new JTextPane();
		txtpnmeal.setText("Price: $" + mealPrice + "/meal, Weight: "+ mealWeight + "pounds/meal");
		GridBagConstraints gbc_txtpnmeal = new GridBagConstraints();
		gbc_txtpnmeal.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnmeal.fill = GridBagConstraints.BOTH;
		gbc_txtpnmeal.gridx = 9;
		gbc_txtpnmeal.gridy = 4;
		contentPane.add(txtpnmeal, gbc_txtpnmeal);
		
		textFieldFood = new JTextField();
		textFieldFood.setText("0");
		GridBagConstraints gbc_textFieldFood = new GridBagConstraints();
		gbc_textFieldFood.anchor = GridBagConstraints.ABOVE_BASELINE;
		gbc_textFieldFood.gridwidth = 4;
		gbc_textFieldFood.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldFood.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldFood.gridx = 12;
		gbc_textFieldFood.gridy = 4;
		contentPane.add(textFieldFood, gbc_textFieldFood);
		textFieldFood.setColumns(10);
		
		txtpnFoodCost = new JTextPane();
		txtpnFoodCost.setEditable(false);
		GridBagConstraints gbc_txtpnFoodCost = new GridBagConstraints();
		gbc_txtpnFoodCost.gridwidth = 4;
		gbc_txtpnFoodCost.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnFoodCost.fill = GridBagConstraints.BOTH;
		gbc_txtpnFoodCost.gridx = 16;
		gbc_txtpnFoodCost.gridy = 4;
		contentPane.add(txtpnFoodCost, gbc_txtpnFoodCost);

/**
 * Oxen
 */

		txtpnOxen = new JTextPane();
		txtpnOxen.setText("Oxen");
		GridBagConstraints gbc_txtpnOxen = new GridBagConstraints();
		gbc_txtpnOxen.gridwidth = 4;
		gbc_txtpnOxen.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnOxen.fill = GridBagConstraints.BOTH;
		gbc_txtpnOxen.gridx = 5;
		gbc_txtpnOxen.gridy = 5;
		contentPane.add(txtpnOxen, gbc_txtpnOxen);
		
		txtpnanimal = new JTextPane();
		txtpnanimal.setText("Price: $" + animalPrice + "/animal, Weight: "+ animalWeight + "animal/bullet");
		GridBagConstraints gbc_txtpnanimal = new GridBagConstraints();
		gbc_txtpnanimal.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnanimal.fill = GridBagConstraints.BOTH;
		gbc_txtpnanimal.gridx = 9;
		gbc_txtpnanimal.gridy = 5;
		contentPane.add(txtpnanimal, gbc_txtpnanimal);
		
		textFieldOxen = new JTextField();
		textFieldOxen.setText("0");
		GridBagConstraints gbc_textFieldOxen = new GridBagConstraints();
		gbc_textFieldOxen.anchor = GridBagConstraints.ABOVE_BASELINE;
		gbc_textFieldOxen.gridwidth = 4;
		gbc_textFieldOxen.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldOxen.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldOxen.gridx = 12;
		gbc_textFieldOxen.gridy = 5;
		contentPane.add(textFieldOxen, gbc_textFieldOxen);
		textFieldOxen.setColumns(10);
		
		txtpnOxenCost = new JTextPane();
		txtpnOxenCost.setEditable(false);
		GridBagConstraints gbc_txtpnOxenCost = new GridBagConstraints();
		gbc_txtpnOxenCost.gridwidth = 4;
		gbc_txtpnOxenCost.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnOxenCost.fill = GridBagConstraints.BOTH;
		gbc_txtpnOxenCost.gridx = 16;
		gbc_txtpnOxenCost.gridy = 5;
		contentPane.add(txtpnOxenCost, gbc_txtpnOxenCost);
		
/**
 * WagonParts		
 */
		txtpnWagonParts = new JTextPane();
		txtpnWagonParts.setEditable(false);
		txtpnWagonParts.setText("Buy Wagon Parts");
		GridBagConstraints gbc_txtpnWagonParts = new GridBagConstraints();
		gbc_txtpnWagonParts.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnWagonParts.fill = GridBagConstraints.BOTH;
		gbc_txtpnWagonParts.gridx = 9;
		gbc_txtpnWagonParts.gridy = 6;
		contentPane.add(txtpnWagonParts, gbc_txtpnWagonParts);
		
/**
 * Wheel
 */
		
		txtpnWheel = new JTextPane();
		txtpnWheel.setText("Wheel");
		GridBagConstraints gbc_txtpnWheel = new GridBagConstraints();
		gbc_txtpnWheel.gridwidth = 4;
		gbc_txtpnWheel.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnWheel.fill = GridBagConstraints.BOTH;
		gbc_txtpnWheel.gridx = 5;
		gbc_txtpnWheel.gridy = 7;
		contentPane.add(txtpnWheel, gbc_txtpnWheel);
		
		txtpnwheel = new JTextPane();
		txtpnwheel.setText("Price: $" + wheelPrice + "/wheel, Weight: "+ wheelWeight + "pounds/wheel");
		GridBagConstraints gbc_txtpnwheel = new GridBagConstraints();
		gbc_txtpnwheel.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnwheel.fill = GridBagConstraints.BOTH;
		gbc_txtpnwheel.gridx = 9;
		gbc_txtpnwheel.gridy = 7;
		contentPane.add(txtpnwheel, gbc_txtpnwheel);
		
		textFieldWheel = new JTextField();
		textFieldWheel.setText("0");
		GridBagConstraints gbc_textFieldWheel = new GridBagConstraints();
		gbc_textFieldWheel.anchor = GridBagConstraints.ABOVE_BASELINE;
		gbc_textFieldWheel.gridwidth = 4;
		gbc_textFieldWheel.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldWheel.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldWheel.gridx = 12;
		gbc_textFieldWheel.gridy = 7;
		contentPane.add(textFieldWheel, gbc_textFieldWheel);
		textFieldWheel.setColumns(10);
		
		txtpnWheelCost = new JTextPane();
		txtpnWheelCost.setEditable(false);
		GridBagConstraints gbc_txtpnWheelCost = new GridBagConstraints();
		gbc_txtpnWheelCost.gridwidth = 4;
		gbc_txtpnWheelCost.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnWheelCost.fill = GridBagConstraints.BOTH;
		gbc_txtpnWheelCost.gridx = 16;
		gbc_txtpnWheelCost.gridy = 7;
		contentPane.add(txtpnWheelCost, gbc_txtpnWheelCost);

/**
 * Axle
 */
		txtpnAxle = new JTextPane();
		txtpnAxle.setText("Axle");
		GridBagConstraints gbc_txtpnAxle = new GridBagConstraints();
		gbc_txtpnAxle.gridwidth = 4;
		gbc_txtpnAxle.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnAxle.fill = GridBagConstraints.BOTH;
		gbc_txtpnAxle.gridx = 5;
		gbc_txtpnAxle.gridy = 8;
		contentPane.add(txtpnAxle, gbc_txtpnAxle);
		
		txtpnaxle = new JTextPane();
		txtpnaxle.setText("Price: $" + axlePrice + "/axle, Weight: "+ axleWeight + "pounds/axle");
		GridBagConstraints gbc_txtpnaxle = new GridBagConstraints();
		gbc_txtpnaxle.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnaxle.fill = GridBagConstraints.BOTH;
		gbc_txtpnaxle.gridx = 9;
		gbc_txtpnaxle.gridy = 8;
		contentPane.add(txtpnaxle, gbc_txtpnaxle);
		
		textFieldAxle = new JTextField();
		textFieldAxle.setText("0");
		GridBagConstraints gbc_textFieldAxle = new GridBagConstraints();
		gbc_textFieldAxle.anchor = GridBagConstraints.ABOVE_BASELINE;
		gbc_textFieldAxle.gridwidth = 4;
		gbc_textFieldAxle.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldAxle.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldAxle.gridx = 12;
		gbc_textFieldAxle.gridy = 8;
		contentPane.add(textFieldAxle, gbc_textFieldAxle);
		textFieldAxle.setColumns(10);
		
		txtpnAxleCost = new JTextPane();
		txtpnAxleCost.setEditable(false);
		GridBagConstraints gbc_txtpnAxleCost = new GridBagConstraints();
		gbc_txtpnAxleCost.gridwidth = 4;
		gbc_txtpnAxleCost.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnAxleCost.fill = GridBagConstraints.BOTH;
		gbc_txtpnAxleCost.gridx = 16;
		gbc_txtpnAxleCost.gridy = 8;
		contentPane.add(txtpnAxleCost, gbc_txtpnAxleCost);

/**
 * Tongue
 */
		txtpnTongue = new JTextPane();
		txtpnTongue.setText("Tongue");
		GridBagConstraints gbc_txtpnTongue = new GridBagConstraints();
		gbc_txtpnTongue.gridwidth = 4;
		gbc_txtpnTongue.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnTongue.fill = GridBagConstraints.BOTH;
		gbc_txtpnTongue.gridx = 5;
		gbc_txtpnTongue.gridy = 9;
		contentPane.add(txtpnTongue, gbc_txtpnTongue);
		
		txtpntongue = new JTextPane();
		txtpntongue.setText("Price: $" + tonguePrice + "/tongue, Weight: "+ tongueWeight + "pounds/tongue");
		GridBagConstraints gbc_txtpntongue = new GridBagConstraints();
		gbc_txtpntongue.insets = new Insets(0, 0, 5, 5);
		gbc_txtpntongue.fill = GridBagConstraints.BOTH;
		gbc_txtpntongue.gridx = 9;
		gbc_txtpntongue.gridy = 9;
		contentPane.add(txtpntongue, gbc_txtpntongue);
		
		textFieldTongue = new JTextField();
		textFieldTongue.setText("0");
		GridBagConstraints gbc_textFieldTongue = new GridBagConstraints();
		gbc_textFieldTongue.anchor = GridBagConstraints.ABOVE_BASELINE;
		gbc_textFieldTongue.gridwidth = 4;
		gbc_textFieldTongue.insets = new Insets(0, 0, 5, 5);
		gbc_textFieldTongue.fill = GridBagConstraints.HORIZONTAL;
		gbc_textFieldTongue.gridx = 12;
		gbc_textFieldTongue.gridy = 9;
		contentPane.add(textFieldTongue, gbc_textFieldTongue);
		textFieldTongue.setColumns(10);
		
		txtpnTongueCost = new JTextPane();
		txtpnTongueCost.setEditable(false);
		GridBagConstraints gbc_txtpnTongueCost = new GridBagConstraints();
		gbc_txtpnTongueCost.gridwidth = 4;
		gbc_txtpnTongueCost.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnTongueCost.fill = GridBagConstraints.BOTH;
		gbc_txtpnTongueCost.gridx = 16;
		gbc_txtpnTongueCost.gridy = 9;
		contentPane.add(txtpnTongueCost, gbc_txtpnTongueCost);
		
		
/**
 * Total cost labels
 */
		txtpnCash = new JTextPane();
		txtpnCash.setText("Available Cash: $" + StartScreen.pControl.getCash());
		txtpnCash.setEditable(false);
		GridBagConstraints gbc_txtpnCash = new GridBagConstraints();
		gbc_txtpnCash.gridwidth = 4;
		gbc_txtpnCash.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnCash.fill = GridBagConstraints.BOTH;
		gbc_txtpnCash.gridx = 5;
		gbc_txtpnCash.gridy = 10;
		contentPane.add(txtpnCash, gbc_txtpnCash);		
		
		txtpnWeight = new JTextPane();
		txtpnWeight.setText("Available Weight: " + StartScreen.pControl.getWeight() + " pounds");
		txtpnWeight.setEditable(false);
		GridBagConstraints gbc_txtpnWeight = new GridBagConstraints();
		gbc_txtpnWeight.gridwidth = 4;
		gbc_txtpnWeight.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnWeight.fill = GridBagConstraints.BOTH;
		gbc_txtpnWeight.gridx = 5;
		gbc_txtpnWeight.gridy = 11;
		contentPane.add(txtpnWeight, gbc_txtpnWeight);	
		
		
		txtpnCostLabel = new JTextPane();
		txtpnCostLabel.setText("Purchase Cost");
		txtpnCostLabel.setEditable(false);
		GridBagConstraints gbc_txtpnCostLabel = new GridBagConstraints();
		gbc_txtpnCostLabel.gridwidth = 4;
		gbc_txtpnCostLabel.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnCostLabel.fill = GridBagConstraints.BOTH;
		gbc_txtpnCostLabel.gridx = 12;
		gbc_txtpnCostLabel.gridy = 10;
		contentPane.add(txtpnCostLabel, gbc_txtpnCostLabel);
		
		
		txtpnTotalCost = new JTextPane();
		txtpnTotalCost.setEditable(false);
		GridBagConstraints gbc_txtpnTotalCost = new GridBagConstraints();
		gbc_txtpnTotalCost.gridwidth = 4;
		gbc_txtpnTotalCost.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnTotalCost.fill = GridBagConstraints.BOTH;
		gbc_txtpnTotalCost.gridx = 16;
		gbc_txtpnTotalCost.gridy = 10;
		contentPane.add(txtpnTotalCost, gbc_txtpnTotalCost);
		
		
		txtpnWeightLabel = new JTextPane();
		txtpnWeightLabel.setText("Current Purchase Weight");
		txtpnWeightLabel.setEditable(false);
		GridBagConstraints gbc_txtpnWeightLabel = new GridBagConstraints();
		gbc_txtpnWeightLabel.gridwidth = 4;
		gbc_txtpnWeightLabel.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnWeightLabel.fill = GridBagConstraints.BOTH;
		gbc_txtpnWeightLabel.gridx = 12;
		gbc_txtpnWeightLabel.gridy = 11;
		contentPane.add(txtpnWeightLabel, gbc_txtpnWeightLabel);

		txtpnTotalWeight = new JTextPane();
		txtpnTotalWeight.setEditable(false);
		GridBagConstraints gbc_txtpnTotalWeight = new GridBagConstraints();
		gbc_txtpnTotalWeight.gridwidth = 4;
		gbc_txtpnTotalWeight.insets = new Insets(0, 0, 5, 5);
		gbc_txtpnTotalWeight.fill = GridBagConstraints.BOTH;
		gbc_txtpnTotalWeight.gridx = 16;
		gbc_txtpnTotalWeight.gridy = 11;
		contentPane.add(txtpnTotalWeight, gbc_txtpnTotalWeight);

/**
 * 
 * Browntourage Label
 */
		
		btnCalculate = new JButton("Calculate");
		btnCalculate.setBackground(Color.cyan);
		btnCalculate.addActionListener(calculateListener);
		GridBagConstraints gbc_btnCalculate = new GridBagConstraints();
		gbc_btnCalculate.gridwidth = 4;
		gbc_btnCalculate.insets = new Insets(0, 0, 5, 5);
		gbc_btnCalculate.gridx = 9;
		gbc_btnCalculate.gridy = 12;
		contentPane.add(btnCalculate, gbc_btnCalculate);
		
		btnSealTheDeal = new JButton("Seal the Deal!");
		btnSealTheDeal.setBackground(Color.cyan);
		GridBagConstraints gbc_btnSealTheDeal = new GridBagConstraints();
		gbc_btnSealTheDeal.gridwidth = 4;
		gbc_btnSealTheDeal.insets = new Insets(0, 0, 5, 5);
		gbc_btnSealTheDeal.gridx = 9;
		gbc_btnSealTheDeal.gridy = 13;
		contentPane.add(btnSealTheDeal, gbc_btnSealTheDeal);

		txtpnBrowntourage = new JTextPane();
		txtpnBrowntourage.setEditable(false);
		txtpnBrowntourage.setForeground(Color.BLACK);
		txtpnBrowntourage.setText("Browntourage");
		GridBagConstraints gbc_txtpnBrowntourage = new GridBagConstraints();
		gbc_txtpnBrowntourage.gridwidth = 3;
		gbc_txtpnBrowntourage.fill = GridBagConstraints.BOTH;
		gbc_txtpnBrowntourage.gridx = 18;
		gbc_txtpnBrowntourage.gridy = 17;
		contentPane.add(txtpnBrowntourage, gbc_txtpnBrowntourage);
		
	}
	
	/**
	 * @return the isBuy
	 */
	public boolean getIsBuy() {
		return isBuy;
	}


	/**
	 * @param isBuy the isBuy to set
	 */
	public void setIsBuy(boolean isBuy) {
		this.isBuy = isBuy;
	}

	private class ButtonListener implements ActionListener{
			
			public void actionPerformed(ActionEvent ae){
				
				if(ae.getActionCommand() == "Buy"){
					
					setIsBuy(true);
					System.out.println(isBuy);
				}
				
				if(ae.getActionCommand() == "Sell"){
					
					setIsBuy(false);
					System.out.println(isBuy);
				}
				
						
		}
			
	}
	
	private class CalculateListener implements ActionListener{
		
		public void actionPerformed(ActionEvent ae){
			
			try{
				Integer Ammunition = Integer.parseInt(textFieldAmmunition.getText());
				Ammunition*=bulletPrice;
				txtpnAmmunitionCost.setText("$" + Ammunition.toString());
			}
			catch(Exception e){
				JOptionPane.showMessageDialog(null, "Enter a valid integer for the number of bullets you wish to trade");
			}
			
			try{
				Integer Medicine = Integer.parseInt(textFieldMedicine.getText());
				Medicine*=bottlePrice;
				txtpnMedicineCost.setText("$" + Medicine.toString());
			}
			catch(Exception e){
				JOptionPane.showMessageDialog(null, "Enter a valid integer for the number of bottles you wish to trade");
			}
			
			try{
				Integer Food = Integer.parseInt(textFieldFood.getText());
				Food*=mealPrice;
				txtpnFoodCost.setText("$" + Food.toString());
			}
			catch(Exception e){
				JOptionPane.showMessageDialog(null, "Enter a valid integer for the number of meals you wish to trade");
			}	
			
			try{
				Integer Oxen = Integer.parseInt(textFieldOxen.getText());
				Oxen*=animalPrice;
				txtpnOxenCost.setText("$" + Oxen.toString());
			}
			catch(Exception e){
				JOptionPane.showMessageDialog(null, "Enter a valid integer for the number of animals you wish to trade");
			}	
			
			try{
				Integer Wheel = Integer.parseInt(textFieldWheel.getText());
				Wheel*=animalPrice;
				txtpnOxenCost.setText("$" + Wheel.toString());
			}
			catch(Exception e){
				JOptionPane.showMessageDialog(null, "Enter a valid integer for the number of wheels you wish to trade");
			}	
			
	}
		
}

}
